from selenium import webdriver
from selenium.webdriver.common.by import By
import time

class Test:
    # 打开游览器
    def __init__(self):
        self.driver = webdriver.Chrome()
    def get_so(self,content):
        # 打开360网页
        self.driver.get('https://www.so.com')
        # 输入搜索内容
        self.driver.find_element(By.ID,'input').send_keys(content)
        time.sleep(2)
        # 点击搜索按钮
        self.driver.find_element(By.ID,'search-button').click()
    # 退出游览器
    def quit(self):
        time.sleep(2)
        self.driver.quit()

if __name__ == '__main__':
    tt = Test()
    tt.get_so('天气预报')
    tt.quit()